package com.maschinenstuermer.profiler.test;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class App {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		App app = new App();
		for (int i = 0; i < 35; i++) {
			app.doSomething(i);
		}
	}
	
	public void doSomething(int i) {
		System.out.println("at " + i);
		recursion(i);
	}

	private void recursion(int depth) {
		if (depth > 0) {
			System.out.println("depth:" + depth);
			recursion(depth-1);
		}
	}

	public void throwUncheckedException() {
		throw new UnsupportedOperationException();
	}
	
	public void throwException() throws IOException {
		File f = File.createTempFile("App", ".txt");
		f.delete();
		FileReader reader = null;
		try {
			reader = new FileReader(f);
			while(reader.read() > 0);
		}
		finally {
			if (reader != null) {
				reader.close();
			}
		}
	}
}
